<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>我的店铺</title>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
var currentPage=${currentPage};
var totalPage = ${totalPage};
function getList(){
	location.href="SellerGoodsListServlet?currentPage="+currentPage;
}
function sel(obj){
	currentPage = obj.value;
	getList();
}
function add(){
	location.href="goodsedit.jsp";
}
function del(id){
	if(confirm("是否确定删除？")){
		location.href="SellerGoodsDelServlet?id="+id+"&currentPage="+currentPage;
	}
}
function update(id,name,price,account){
	location.href="goodsedit.jsp?id="+id+"&name="+name+"&price="+price+"&account="+account+"&currentPage="+currentPage;
}
function she(id,state){
	location.href="SellerGoodsShelvesServlet?id="+id+"&state="+state+"&currentPage="+currentPage;
}
</script>
</head>
<body>
<jsp:include page="head.jsp"/>
<div id="container">
<input type="button" value="添加" onclick="add();">
<table class="zebra" width="80%" border="1">
<tr>
	<th>商品名称</th><th>价格</th><th>库存</th><th>状态</th><th>操作</th>
</tr>
<c:forEach items="${list}" var="g">
<tr>
	<td>${g.goodsName }</td>
	<td>${g.goodsPrice }</td>
	<td>${g.goodsAccount }</td>
	<td>${g.goodsShelves==0?'下架中':'上架中' }</td>
	<td>
		<input type="button" value="${g.goodsShelves==0?'上架':'下架' }" onclick="she(${g.goodsId},${g.goodsShelves});">
		<input type="button" value="删除" onclick="del(${g.goodsId});">
		<input type="button" value="修改" onclick="update(${g.goodsId},'${g.goodsName }',${g.goodsPrice },${g.goodsAccount});">
	</td>
</tr>
</c:forEach>
</table>
<jsp:include page="page.jsp"/>
</div>
</body>
</html>